package com.supreme.nettyapp.generalserver.echoserver;

import com.supreme.nettyapp.generalserver.echoserver.service.EchoServerService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
@ConditionalOnProperty(prefix = "netty.echo-server", name = "enabled", havingValue = "true")
public class EchoServerStarter {

    @Resource
    private EchoServerService echoServerService;

    @PostConstruct
    public void echoServerStarter() {
        System.out.println("echoServerStarter");
        echoServerService.startNettyServer();
    }

}
